package com.xxx.generator.common.vo;

import com.baomidou.mybatisplus.core.metadata.IPage;
import lombok.Data;

import java.util.List;

/**
 * @author 邢晨旭
 * {@code @date} 2023/11/19
 */
@Data
public class PageVO<T> {

    private Long total;

    private List<T> list;

    public static <T> PageVO<T> of(IPage<T> page) {
        PageVO<T> pageVO = new PageVO<>();
        pageVO.setTotal(page.getTotal());
        pageVO.setList(page.getRecords());
        return pageVO;
    }
    public static <T> PageVO<T> of(Long total,List<T> list) {
        PageVO<T> pageVO = new PageVO<>();
        pageVO.setTotal(total);
        pageVO.setList(list);
        return pageVO;
    }

}
